import { defineStore } from 'pinia';

export const useCourseStore = defineStore('course', {
    state: () => ({
        upcomingCourse: {
            time: '上午9:00',
            id: 1,
            name: '瑜伽基础课'
        }
    }),
    actions: {
        async fetchUpcomingCourse() {
            try {
                // 模拟 API 调用
                // const res = await getUpcomingCourse();
                // this.upcomingCourse = res.data;
                this.upcomingCourse = {
                    time: '上午9:00',
                    id: 1,
                    name: '瑜伽基础课'
                };
            } catch (error) {
                console.error('获取课程失败:', error);
            }
        }
    }
});
